package com.zqx.kafkaproject.kafkademo;

import com.zqx.kafkaproject.kafkademo.components.KafkaReceiver;
import com.zqx.kafkaproject.kafkademo.components.KafkaSender;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class KafkademoApplication {

	public static void main(String[] args) {

		ConfigurableApplicationContext context = SpringApplication.run(KafkademoApplication.class, args);

		KafkaSender sender = context.getBean(KafkaSender.class);

		for (int i = 0 ; i <3 ; i++)
		{
			//调用消息发送类中的消息发送方法
			sender.send();
			try {
				Thread.sleep(10);
			} catch (Exception e) {
				e.printStackTrace();
			}

		}
	}
}
